package de.rs.espresso.cubes;

import java.util.List;

import de.rs.espresso.interfaces.ICube;
import de.rs.espresso.interfaces.IGlobalInformation;

/**
 * Provides a factory class for the centralized creation of the selected cube
 * type.
 * 
 * @author Jan
 * 
 */
public class CubeFactory {

	public enum CubeRepresentation {
		LONG, BYTE_ARRAY
	}

	private static CubeRepresentation representation;

	public static void setCubeRepresentation(CubeRepresentation representation) {
		CubeFactory.representation = representation;
	}

	public static ICube getDontCareCube(IGlobalInformation info) {
		switch (representation) {
		case LONG:
			return new LongCube(info);
		case BYTE_ARRAY:
			// TODO
		default:
			return null;
		}
	}

	public static ICube getCube(List<Byte> inputs, List<Byte> outputs, IGlobalInformation info) {
		switch (representation) {
		case LONG:
			return new LongCube(inputs, outputs, info);
		case BYTE_ARRAY:
			return new ByteArrayCube(inputs, outputs);
		default:
			return null;
		}
	}

	public static ICube getVoidCube(IGlobalInformation info) {
		switch (representation) {
		case LONG:
			LongCube voidCube = new LongCube(info);
			voidCube.setLiteral(0, ICube.VOID);
			return voidCube;
		case BYTE_ARRAY:
			// TODO
			return null;
		default:
			return null;
		}

	}

}
